$.extend({
	encodeData: function(obj){
		var data = new Object();
		jQuery.each(obj, function(index, item){
			data[index] = encodeURI(jQuery.trim(item));
		});
		return data;
	},
	initSelectWithData: function(os, dat){
		if ($.trim(dat) == '') return;
		var ds = dat.split(';');
		$.each(ds, function(i,v){
			var vs = v.split(":");
			os.append('<option value="'+vs[0]+'">'+vs[1]+'</option>');
		});
	},
	getValueOfMap: function(m, c){
		if ($.trim(c) == '' || $.trim(m) == '') return '';
		var ds = m.split(';');
		var result = '';
		$.each(ds, function(i,v){
			var vs = v.split(":");
			if (vs[0] == c ){
				result = vs[1];
				return false;
			}
		});
		return result;
	},
	jqgridAfterSubmit : function(response, postdata) 
	{
		if (response.status == 200){
			var data = $.evalJSON(response.responseText);
			if (data.status == 'OK'){
				return [true,null,null];
			} else {
				return [false,data.msg,null];
			}
		} else {
			return [false,response.responseText,null]; 
		}			
	},
	getFilterBase : function(groupOp, field, op, data){
		return {
			groupOp : groupOp,
			rules:[{field: field, op: op,data: data}]
		};
	}
});

